package org.perche.chat.server.servlet;

import org.perche.chat.server.GuiceModule;
import org.perche.chat.server.ServiceFactory;

import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.servlet.GuiceServletContextListener;


/**
 * Guice servlet configuration
 *
 */
public class GuiceServletConfig extends GuiceServletContextListener {
  @Override
  protected Injector getInjector() {
    Injector injector = Guice.createInjector(new GuiceModule());

    ServiceFactory factory = ServiceFactory.getInstance();
    injector.injectMembers(factory);

    return Guice.createInjector(new GuiceServletModule());
  }
}
